<template>
	<view class="content" v-if="pageshow">
		<u-alert-tips type="warning" description="当前提交信息正在审核中..." v-if="user.status==1 && user.grade!=''"></u-alert-tips>
		<u-alert-tips type="warning" :description="'当前提交信息审核未通过,原因:'+user.nodesc" v-if="user.status==3"></u-alert-tips>
		<view class="head">
			实名认证审核
		</view>
		<view class="con">
			 
			 <u-form-item label-width="150" label="姓名">
				 <u-input v-model="data.realname"  placeholder="请输入您的姓名" />
			</u-form-item>
			 <u-form-item  label-width="150" label="手机">
				 <u-input v-model="data.mobile" type="number"  placeholder="请输入您的手机号码"/>
			 </u-form-item>
			 <u-form-item  label-width="150" label="年级">
				 <u-input  v-model="data.grade" placeholder="请输入您的年级" />
			 </u-form-item>
			 <u-form-item  label-width="150" label="班级">
				 <u-input v-model="data.class"   placeholder="请输入您的班级"/>
			 </u-form-item>
			 <u-form-item  label-width="150" label="公司名称">
				 <u-input v-model="data.company"   placeholder="请输入您的公司名称"/>	 
			 </u-form-item>
		</view>
		
		<view class="desc">
			<u-section title="审核说明" color="rgb(250, 53, 52)" :arrow="false" :right="false"></u-section>
		    <view class="desc1">1、请确认信息是否填写准确</view>
			<view class="desc1">2、审核通过后可正常浏览本小程序</view>
		  </view>
		  
		  <view><u-button type="error" :loading="loading" throttle-time="500" @click="updateuser">提交审核</u-button></view>
		  <view style="margin-top: 20rpx;"><u-button type="success"  @click="jumpbar('/pages/index/index')">返回首页</u-button></view>
	</view>
</template>

<script>
	
	export default {
		data() {
			return {
				pageshow:false,
				jcshow:false,
				radio:"未完成",
				radioList: [
								{
									name: '未完成',
									disabled: false,
									
								},
								{
									name: '已完成',
									disabled: false
								}
							],
				loading: false,
				data: {},
				layershow: false,
				usershow:false,
				cpshow: false,
				glshow: false,
				historyDatas: [],
				keyworkDatas: [],
				//数据源
				itemData: [],
			}
		},
		

		onLoad: function(e) {
		
			    if (this.user.realname)
				     this.data.realname=this.user.realname
				if (this.user.mobile)
				    this.data.mobile=this.user.mobile
					
				if (this.user.grade)
				     this.data.grade=this.user.grade
				if (this.user.class)
				    this.data.class=this.user.class
				if (this.user.company)
					this.data.company=this.user.company
			 
				 this.pageshow=true
			
		},
		methods: {
			
			updateuser() {
              if (this.data.realname=="" || this.data.realname== null){
              	   this.msg("姓名不能为空");return
              }
			  
			  if (this.data.mobile=="" || this.data.mobile == null){
			  	   this.msg("手机不能为空");return
			  }
			  if (this.data.grade=="" || this.data.grade == null){
			  	   this.msg("年级不能为空");return
			  }
			  if (this.data.class=="" || this.data.class == null){
			  	   this.msg("班级不能为空");return
			  }
			  
			  if (this.data.company=="" || this.data.company == null){
			  	   this.msg("公司名称不能为空");return
			  }

			   this.data.uid=this.user.id
		
			
			   this.$u.post('index.php?class=user&act=updateuser', this.data).then(res => {
			   	  if (res.code==0){
					  uni.setStorageSync("user",res.data)
					  this.user=res.data
					  this.msg("提交成功,请等待审核");
					  //this.jump("/pages/user/list")
				  }else{
					  this.msg(res.msg)
				  }
			   
			   });
			},
			confirm_jc(e) {
			 this.data.jctext=e[0].label
			 this.data.jc=e[0].value
		  },
		
			//内容搜索
			Listen(value) {
				//防抖
				this.$u.throttle(this.listenaction(value), 500)
			},
			listenaction(value) {

				this.$u.post('index.php?class=user&act=search', {
					key: value
				}).then(res => {

					this.keyworkDatas = res.data;

				});
			},
			//列表点击事件
			onItemClick(event) {
				let item = event.item;
				let index = event.index;
				this.data.usertext = item
				this.data.user = this.keyworkDatas[index].id
				this.layershow = false

			},
		}
	}
</script>

<style scoped>
	.desc1{margin: 30rpx auto; color: #999;}
	.content{padding:20rpx;position: fixed;
	width: 100vw;
	height: 100vh;
	overflow: hidden;
	z-index: 11111;
	top: 0;}
	.head{font-size: 26px; margin-top: 20px; margin-left: 5px;}
	.con{margin: 50rpx auto;}
</style>
